//
//  TransferModels.swift
//  甜言蜜语
//
//  Created by 王剑伟 on 16/7/14.
//  Copyright © 2016年 wl. All rights reserved.
//

import Foundation
import SwiftyJSON

class TransferModel: NewsModelInitProtocol {
    var id: Int
    var name: String
    var imgsrc: String
    var price: String
    var ptime: String
    var newold: String?
    var type: String
    var area: String
    var address: String
    
    required init(json: JSON) {
        id = json["id"].intValue
        name = json["name"].stringValue
        imgsrc = json["imgsrc"].stringValue
        price = json["price"].stringValue
        ptime = json["ptime"].stringValue
        newold = json["newold"].stringValue
        type = json["type"].stringValue
        area = json["area"].stringValue
        address = json["address"].stringValue
    }
}

class TransferPictureModel: NewsModelInitProtocol {
    var id: Int
    var imgurl: String
    
    required init(json: JSON) {
        id = json["id"].intValue
        imgurl = json["imgurl"].stringValue
    }
}

class TransferDetailModel: NewsModelInitProtocol {
    var id: Int
    var name: String
    var imgsrc: String
    var price: String
    var title: String
    var ptime: String
    var browerNum: String
    var treasureType: String
    var type: String
    var body: String
    var area: String
    var address: String
    var contacts: String
    var tel: String
    var size: String
    var rent: String
    var rmlist: [TransferModel]
    var transferPics: [TransferPictureModel]
    var buyprice: String
    var newold: String
    var username : String
    var usertimg: String
    var userid: String
    required init(json: JSON) {
        id = json["id"].intValue
        name = json["name"].stringValue
        imgsrc = json["imgsrc"].stringValue
        title = json["title"].stringValue
        price = json["price"].stringValue
        ptime = json["ptime"].stringValue
        browerNum = json["browernum"].stringValue
        treasureType = json["treasuretype"].stringValue
        type = json["type"].stringValue
        body = json["body"].stringValue
        area = json["area"].stringValue
        address = json["address"].stringValue
        contacts = json["contacts"].stringValue
        tel = json["tel"].stringValue
        size = json["size"].stringValue
        rent = json["rent"].stringValue
        rmlist = ModelArrayProvider.arrayModel(TransferModel.self, json: json["rmlist"])!
        transferPics = ModelArrayProvider.arrayModel(TransferPictureModel.self, json: json["transferpics"])!
        buyprice = json["buyprice"].stringValue
        newold = json["newold"].stringValue
        username = json["username"].stringValue
        usertimg = json["usertimg"].stringValue
        userid = json["userid"].stringValue
    }
}